import { DIALOG } from "../../Action/dialog/dialog";
import objectAssign from "object-assign";
const initData = {
	show: false, //是否展示
	title: "", //弹窗标题
	type: "confirm", //弹窗类型 confirm/alert/iconText/contract/sms
	content: "", //弹窗内容
	time: 0, //弹窗消失时间  单位 毫秒
	//width:'',//弹窗宽度
	//heigth:'',//弹窗高度
	bgRemove: false, //点击遮罩层是否移除弹窗
	success: () => {
		return true;
	}, //点击确定回调函数
	fail: () => {}, //点击取消回调函数
	hide: () => {}, //遮罩层消失回调函数
	successText: "继续", //确认框--确认按钮文案
	failText: "取消", //确认框--取消按钮文案
	okText: "知道了", //弹框--确定按钮文案
	addClass: "", //扩展class
	closeFlag: false, //点击确认和取消是否关闭弹窗  true 不关闭弹窗 默认false 关闭弹窗
	moduleName: "" //模块名称
};

//记录商品列表页数据状态
const dialog = (state = initData, action = {}) => {
	switch (action.type) {
		case DIALOG:
			if (action.options.reset) {
				return objectAssign({}, state, initData);
			} else {
				return objectAssign({}, state, action.options);
			}

		default:
			return state;
	}
};
export default dialog;
